
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="com.seniorproject.aims.Log"%>

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Log out</title>
</head>
<body>

<%
	/* Log file */
	String strUser = String.valueOf(session.getAttribute("sUser"));
	String log = "";
	
	if("admin".equals(strUser)) {
		log = "admin logout";
		Log.writeAdminFile(log);		
	}
	else {
		String name = String.valueOf(session.getAttribute("name"));
		String surname = String.valueOf(session.getAttribute("surname"));
		log = strUser+" "+name+" "+surname+" logout";
		
		Log.writeUserFile(log);
	}
	
	
	// clear session
	request.getSession().invalidate();

	response.sendRedirect("login.jsp");
%>


</body>
</html>